#include "profile.hpp"
//#include "comm.hpp"
#define NUM 1024

int main()
{
    
    //只读打开文件
    int fd = open(FIFO_FILE,O_RDONLY);
    if(fd == -1)
    {
        perror("open");
        exit(OPEN_FIFO_ERR);
    }

    while(true)
    {
        char buf[NUM];
        buf[0] = 0;
        int n = read(fd,buf,sizeof(buf));
        if(n > 0)
        {
            buf[n] = 0;
            cout << buf<< endl;
        }
        else if(n == 0)
        {
            cout<<"write exit,me too"<<endl;
            break;
        }
        else{
            perror("read");
            break;
        }
       
    }
    close(fd);
    return 0;
}